<?php

/*
=====================================================
 Generic Toolbox - by Carl Wells
-----------------------------------------------------
-----------------------------------------------------
 Copyright (c) 2009 Carl Wells
=====================================================
 THIS IS COPYRIGHTED SOFTWARE
 PLEASE READ THE LICENSE AGREEMENT
=====================================================
 File: system/display/admindisplay.class.php
-----------------------------------------------------
 Purpose: This file builds all visual aspects of the Admin Section.
 All browser output is managed by this file.
=====================================================
*/
class Sectordisplay extends Admindisplay
{

var $sectors;
	
	function displaySectors(){
	
	// instantiate a Sector Object
        require_once ("core/sector.class.php");
        $SECTOR = new Sector();
        
        $sectors = $SECTOR->getSectors();
        echo "<h2 class=\"adminHeader\">Sections</h2>";
        echo "<div class=\"sectionBlock\">";
        echo ("<p class=\"adminLinkHead\">Add Section <a href=\"index.php?act=addsector\"><img src=\"../images/add_blue_item.gif\" alt=\"Add Section\" /></a></p>");
        
        
        foreach ($sectors as $array){
        	echo "<p class=\"adminLink\">".($array['nameOfSector']." <a href=\"index.php?act=sectoredit&id=".$array['id']."\" ><img src=\"../images/edit_blue_item.gif\" alt=\"Edit Section\" /></a> <a href=\"deletesector.php?id=".$array['id']."\" onclick=\"return confirmLink(this, 'delete ".$array['nameOfSector']." from the system.')\"><img src=\"../images/delete_blue_item.gif\" alt=\"Delete Section\" /></a></p>");
        }
         echo "</div>";
        
	
	}
		
	function displayEditSector($id){
			$html = "<form method=\"post\" action=\"updatesector.php\" name=\"insertForm\"  enctype=\"multipart/form-data\">\n";
		// instantiate a Sector Object
			require_once ("core/sector.class.php");
     		$SECTOR = new Sector();
     
     
			$html .= "<input type=\"hidden\" name=\"db\" value=\"aramark\" />";
			$html .= "<input type=\"hidden\" name=\"table\" value=\"sectors\" />";
			$html .= "<input type=\"hidden\" name=\"sectorId\" value=\"".$id."\" />";
	
			
			$sectors = $SECTOR->getSectors($id);

			$html .= "<table>";
			$html .= "<tr>";
        
			foreach ($sectors as $array){
		        $html .= "<td>Name Of Sector <input type=\"text\" name=\"editSectorName\" value=\"".$array['nameOfSector']."\" size=\"30\" class=\"textfield\" tabindex=\"1\" /></td>\n";
			}
        
			$html .= "</tr>";
			$html .= "<tr>";
			$html .= "<td><input type=\"submit\" value=\"Go\" /></td>\n";
			$html .= "</tr>";
			$html .= "</table>";
			$html .= "</form>\n";
			
	        echo $html;
	}
	
	function addSector(){
			$html = "<form method=\"post\" action=\"addsector.php\" name=\"insertForm\"  enctype=\"multipart/form-data\">\n";
		// instantiate a Sector Object
			require_once ("core/sector.class.php");
     		$SECTOR = new Sector();

			$html .= "<table>";
			$html .= "<tr>";
        
		    $html .= "<td>Name Of Sector <input type=\"text\" name=\"editSectorName\" value=\"\" size=\"30\" class=\"textfield\" tabindex=\"1\" /></td>\n";
        
			$html .= "</tr>";
			$html .= "<tr>";
			$html .= "<td><input type=\"submit\" value=\"Go\" /></td>\n";
			$html .= "</tr>";
			$html .= "</table>";
			$html .= "</form>\n";
			
	        echo $html;
	
	}
}

?>